package com.guchenbo.study.mvc.servlet31.springmvc;

import javax.servlet.*;
import java.io.IOException;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @Author guchenbo
 * @Date 2019/11/30.
 */
public class StudyFilter implements Filter {

    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("init study filter");
    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
                    throws IOException, ServletException {
        System.out.println("in Study Filter");
        chain.doFilter(request, response);
    }

    public void destroy() {

    }

    public static void main(String[] args) {
        ReentrantLock lock = new ReentrantLock();
        Condition condition = lock.newCondition();
        lock.lock();
        System.out.println(condition);
        try {
            condition.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
